var session = require("express-session");
var MongoStore = require("connect-mongo");

var cookieParser = require("cookie-parser");
let sessionCheck = (app, req, res) => {
    if (app) {
        // app.use(session({ secret: "userName" }));
        // app.use(cookieParser());
        // app.use(
        // session({
        // resave: true, // don't save session if unmodified  req.session.user
        // saveUninitialized: false, // don't create session until something stored
        // secret: "userName",
        // store: new MongoStore({
        // db: "esession",
        // host: "localhost",
        // port: 27017,
        // collection: "sessions", // 存在哪个集合里，默认为sessions
        // ttl: 10, // session过期时间
        // autoRemove: "native", // mongo2.2+自动移除过期的session，disable为禁用
        // autoRemoveInterval: 10, //移除过期session间隔时间,默认为10分钟
        // touchAfter: 24 * 3600, //同步session间隔，默认每次请求都会同步到数据库
        // }),
        // })
        // );
    }
};
module.exports = sessionCheck;
